﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyAlbum.Data;
using MyAlbum.Utility;

namespace MyAlbum.Services
{
    public class TagEntryService:ITagEntryService
    {
        private ITagEntryRepository _repository;
        public TagEntryService(ITagEntryRepository repository)
        {
            Assert.IsNotNull(repository);
            this._repository = repository;
        }

        /// <summary>
        /// Returns all tags
        /// </summary>
        /// <returns>IEnumerable&lt;Tag&gt;</returns>
        public IEnumerable<MyAlbum.Model.Tag> GetTags()
        {
            return this._repository.GetTags();
        }

        /// <summary>
        /// Delete a tag (usually when no entries were found for it,
        /// meaning it's a 'dead' tag) from the tags and tags_entry tables
        /// </summary>
        /// <param name="tagName">The tag name to look for</param>
        public void DeleteTagName(string tagName)
        {
            this._repository.DeleteTagName(tagName);
        }
    }
}
